package com.peaksport.framework.base.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.peaksport.framework.uuid.PKEntityType;

import lombok.Getter;
import lombok.Setter;

@SuppressWarnings("serial")
@MappedSuperclass
@Getter
@Setter
public abstract class CoreBaseEntity implements IEntityObject,Serializable{

	@GenericGenerator(name ="generator", strategy = "com.peaksport.framework.uuid.PKIdentifierGenerator")
	@GeneratedValue(generator = "generator")
	@Id
	@Column(name = "FID", unique = true, nullable = false, length = 44)
	private String id;
	
//	@Transient
//	private PKEntityType entityType;
	@JsonIgnore
	public abstract PKEntityType getEntityType();
//	@SuppressWarnings("unused")
//	private void setEntityType(){
//		throw PKDevException.throwException("不允许对实体重新配置类型");
//	};
	
	
	@Transient
	private Map<String,Object> extendValue = null;
	
	public void setExtendValue(Map<String,Object> extendValue) {
		this.extendValue = extendValue;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public Map<String,Object> getExtendValue() {
		if (extendValue == null) extendValue = new HashMap();
		return extendValue;
	}
	
}
